﻿<%@ Control Language="VB" AutoEventWireup="false" CodeFile="Login.ascx.vb" Inherits="FrontEnd_Control_Users_Login" %>
<%@ Import Namespace="Cls_Common" %>
<script type="text/javascript">
    $(function () {
        $("#<%=txtUserName.ClientID() %>").focus();
        $(":input").keypress(function (e) {
            if (e.keyCode == 13) {
                $("#<%=btnLogin.ClientID()%>").click();
                return false;
            }
        });
        $("#<%= btnLogin.ClientId %>").click(function () {
            $.ajax({
                url: '<%=ResolveUrl("~/Services/wsAutoComplete.asmx/checkLogin")%>',
                data: "{ 'sUserName': '" + $("#<%= txtUserName.ClientId %>").val() + "', 'sPassword': '" + $("#<%= txtPassword.ClientId %>").val() + "' }",
                dataType: "json",
                type: "POST",
                contentType: "application/json; charset=utf-8",
                dataFilter: function (data) {
                    return data;
                },
                success: function (data) {
                    if (eval(data.d) == 1) {

                        //                             $(".cell_tabsystem").attr("style", "display:none");
                        //                             $(".links_user").attr("style", "display:inline");
                        //                             $("#<%= lblUserName.ClientId %>").text($("#<%= txtUserName.ClientId %>").val())
                        var _url = location.href;
                        window.location.href = _url;
                    }
                    else {

                        $("#<%= lblError.ClientId %>").text('Thông tin đăng nhập chưa chính xác');
                    }
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                }
            });
            return false;
        });
    });
</script>
<style type="text/css">
    .class-btn
    {
        color: #fff;
        background-color: #0087F7;
        padding: 9px 20px;
        border: 1px solid #0087F7;
        border-radius: 3px;
        box-shadow: 0 1px 0 rgba(0,0,0,0.08);
        font: bold 14px/20px "Helvetica Neue" , Arial, Helvetica, Geneva, sans-serif;
        cursor: pointer;
        text-decoration: none;
        display: inline-block;
        text-align: center;
        -webkit-appearance: none;
        margin-left: 10px;
    }
    .class-btn:hover, a.btn:hover
    {
        background-color: #33adff;
    }
</style>
<p class="lead">
    Đăng nhập User|
    <asp:HyperLink ID="hplRegist" Text=" Đăng ký" runat="server"></asp:HyperLink>
</p>
<div style="height: 30px;">
    <asp:Label ID="lblError" runat="server" ForeColor="Red" />
</div>
<div class="field">
    <asp:Label ID="lblUserName" CssClass="TextLabel" runat="server" Text="Tên đăng nhập:" />
    <asp:TextBox ID="txtUserName" CssClass="TextBox" MaxLength="16" runat="server"></asp:TextBox>
    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtUserName"
        ErrorMessage="Nhập tên đăng nhập" SetFocusOnError="True">*</asp:RequiredFieldValidator>
</div>
<div class="field">
    <asp:Label ID="lblPassword" CssClass="TextLabel" runat="server" Text="Mật khẩu:" />
    <asp:TextBox ID="txtPassword" CssClass="TextBox" MaxLength="16" runat="server" TextMode="Password"></asp:TextBox>
    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtPassword"
        ErrorMessage="Nhập mật khẩu" SetFocusOnError="True">*</asp:RequiredFieldValidator>
</div>
<div>
    <asp:CheckBox ID="chkRemember" runat="server" Text=" Ghi nhớ đăng nhập" />
    <span>|</span>
    <asp:HyperLink ID="hplRemember" Text="Quên mật khẩu!" runat="server"></asp:HyperLink>
</div>
<div class="btn-container">
    <asp:Button ID="btnLogin" CssClass="buy button" runat="server" Text="Đăng nhập" Style="float: left;" />
    <input type="reset" value="Đặt lại" class="buy button class-btn" style="float: left;" />
</div>
<div>
</div>
